#!/bin/sh
#
# Sample ipfw(8) script for use with ipfw-classifyd
#
# $Id: rc.firewall.example 578 2008-08-02 12:38:05Z mtm $
#

fwcmd=/sbin/ipfw
ifn=bfe0

# Remove all other rules.
#
${fwcmd} -f flush

# Setup a throttled P2P pipe.
#
${fwcmd} pipe 1 config bw 256Kbit/s queue 30
${fwcmd} pipe 2 config bw 256Kbit/s queue 30

# Divert all TCP and UPD packets through our classifier
#
${fwcmd} add 400 divert 7777 tcp from any to any via ${ifn}
${fwcmd} add 410 divert 7777 udp from any to any via ${ifn}

# Pass unclassified packets
${fwcmd} add 1000 allow ip from any to any

# Pipes for throttling packets comming out of the divert(4) socket
#
${fwcmd} add 64000 pipe 1 log ip from any to any in diverted
${fwcmd} add 64001 pipe 2 log ip from any to any out diverted

